import { createRouter, createWebHistory } from 'vue-router'
import Index from '../views/Index.vue'
import BusinessList from '../views/BusinessList.vue'
import BusinessInfo from '../views/BusinessInfo.vue'
import Orders from '../views/Orders.vue'
import UserAddress from '../views/UserAddress.vue'
import Payment from '../views/Payment.vue'
import OrderList from '../views/OrderList.vue'
import AddUserAddress from '../views/AddUserAddress.vue'
import EditUserAddress from '../views/EditUserAddress.vue'
import Register from '../views/Register.vue'
import PreRegisterVue from '../views/PreRegister.vue'
import Login from '../views/Login.vue'
import PersonalCenter from '../views/PersonalCenter.vue' //个人中心
import Search from '../views/Search.vue' //搜索
import EditUserInfo from '../views/EditUserInfo.vue' //编辑个人信息
import EditUserPassword from '../views/EditUserPassword.vue' //设置密码
import Payed from '../views/Payed.vue' //已支付
import Testi from '../views/test-i.vue' 
import Testo from '../views/test-o.vue'
import HongTest from '../views/hongTest.vue'
import AxiosTest from '../views/AxiosTest.vue'
import VshowTest from '../views/VshowTest.vue'
import VifTest from '../views/VifTest.vue'
import GoodsVue from '@/components/Merchant/Goods.vue'
import MerchantCenterVue from '@/components/Merchant/MerchantCenter.vue'
import ShopVue from '@/components/Merchant/Shop.vue'
import orderMsVue from '@/components/Merchant/orderMs.vue'
import McAddressVue from '@/components/Merchant/McAddress.vue'
import AddMcAddressVue from '@/components/Merchant/AddMcAddress.vue'
import EditMcAddressVue from '@/components/Merchant/EditMcAddress.vue'
import McRegisterVue from '@/views/McRegister.vue'
import FoodChangeVue from '@/views/FoodChange.vue'
import FoodCreateVue from '@/views/FoodCreate.vue'
const routes = [{
    path: '/',
    name: 'Home',
    component: Index
  },{
    path: '/index',
    name: 'Index',
    component: Index
  },{
    path: '/businessList/:orderTypeId',
    name: 'BusinessList',
    component: BusinessList
  }, {
		path: '/businessInfo/:businessId',
		name: 'BusinessInfo',
		component: BusinessInfo
	}, {
		path: '/orders/:businessId',
		name: 'Orders',
		component: Orders
	}, {
		path: '/userAddress/:businessId',
		name: 'UserAddress',
		component: UserAddress
	}, {
		path: '/payment/:orderId',
		name: 'Payment',
		component: Payment
	}, {
		path: '/orderList',
		name: 'OrderList',
		component: OrderList
	}, {
		path: '/addUserAddress/:businessId',
		name: 'AddUserAddress',
		component: AddUserAddress
	}, {
		path: '/editUserAddress/:businessId/:daId',
		name: 'EditUserAddress',
		component: EditUserAddress
	}, {
		path: '/register',
		name: 'Register',
		component: Register
	}, {
		path: '/preregister',
		name: 'PreRegisterVue',
		component: PreRegisterVue
	}, {
		path: '/login',
		name: 'Login',
		component: Login
	},{
		path: '/personalCenter',
		name: 'PersonalCenter',
		component: PersonalCenter
	}, {
		path: '/search',
		name: 'Search',
		component: Search
	},{
		path: '/payed/:orderId',
		name: 'Payed',
		component: Payed
	},{
		path: '/editUserInfo',
		name: 'EditUserInfo',
		component: EditUserInfo
	},{
		path: '/editUserPassword',
		name: 'EditUserPassword',
		component: EditUserPassword
	},{
		path: '/testI/:queryTest',
		name: 'Testi',
		component: Testi
	}, {
		path: '/testO',
		name: 'Testo',
		component: Testo
	}, {
		path: '/hongTest',
		name: 'HongTest',
		component: HongTest
	}, {
		path: '/axiosTest',
		name: 'AxiosTest',
		component: AxiosTest
	}, {
		path: '/vshowTest',
		name: 'VshowTest',
		component: VshowTest
	}, {
		path: '/vifTest',
		name: 'VifTest',
		component: VifTest
	}, {
		path: '/goods',
		name: 'GoodsVue',
		component: GoodsVue
	}, {
		path: '/merchantcenter',
		name: 'MerchantCenterVue',
		component:MerchantCenterVue
	}, {
		path: '/shop',
		name: 'ShopVue',
		component: ShopVue
	}, {
		path: '/orderms',
		name: 'orderMsVue',
		component: orderMsVue
	}, {
		path: '/mcaddress/:businessId',
		name: 'McAddressVue',
		component: McAddressVue
	}, {
		path: '/addMcAddress/:businessId',
		name: 'AddMcAddressVue',
		component: AddMcAddressVue
	}, {
		path: '/editMcAddress/:businessId',
		name: 'EditMcAddressVue',
		component: EditMcAddressVue
	}, {
		path: '/mcregister',
		name: 'McRegisterVue',
		component: McRegisterVue
	}, {
		path: '/foodChange/:foodId',
		name: 'FoodChangeVue',
		component: FoodChangeVue
	}, {
		path: '/foodCreate',
		name: 'FoodCreateVue',
		component: FoodCreateVue
	}
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

// 解决重复路由报异常问题
const originalPush = router.push
router.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

export default router